<?php
/**
 * /nmox/main/switchboard.php
 * 
 * The NMOX Server PHP-MAX Switchboard
 * 
 * The Switchboard sets up needed includes, according to preferences
 * (uses CFG class to get/set those, if needed)
 * 
 * Chain notes:
 * "Above" this file: [config.php], nmox.php, x.php, your file
 * 
 * @author David Christian Liedle <david.liedle@gmail.com>
 * @link   http://nmox.org/
 *
 */

# Mastercode must come first:
require_once($NMOX_ROOT_PATH."/main/mastercode.php"); // gets universal and static code

#
# Universal objects, Constantine, Static, xStatic are imported via mastercode
#

################################################################################
# GET CONFIGURATION:
#
if( !strpos($NMOX_CONFIG_FILE, ".php") ){
    require_once($NMOX_ROOT_PATH."/modules/CFG.class.php");
    $myCFG = new CFG($NMOX_CONFIG_FILE);
    $NMOX_CFG = $myCFG->getCFG;
    die( "Not yet set up to read alternate config formats; use .php..." );
} else {
    // using PHP
    require_once($NMOX_ROOT_PATH.$NMOX_CONFIG_FILE);
}

################################################################################
# Get main classes and interfaces:
# (By LOAD ORDER, not alphabetical).
#
require_once($NMOX_ROOT_PATH."/main/interfaces/iTactics.interface.php");
require_once($NMOX_ROOT_PATH."/main/interfaces/iNMOX.interface.php");

require_once($NMOX_ROOT_PATH."/main/classes/Tactics.class.php");
require_once($NMOX_ROOT_PATH."/main/classes/NMOX.class.php");

require_once($NMOX_ROOT_PATH."/main/classes/Page.class.php");
require_once($NMOX_ROOT_PATH."/main/classes/Text.class.php");
require_once($NMOX_ROOT_PATH."/main/classes/Temporal.class.php");

################################################################################
# Import modules according to preferences
# ("MUSE" = "Module USE")
#
foreach( $MUSE as $key=>$value ){
    if( $value ){
        require_once($NMOX_ROOT_PATH.$value);
    }
}

################################################################################
# Annex Test:
#
require_once($NMOX_ROOT_PATH."/annex/annex.php"); // change to conditional include
$myThrowAwayANXClass = new AnnexManager; // JUST FOR TESTING FOR NOW
$myTANXT = new AnnexTest;

################################################################################
# Test the chain:
#
locateMe("/nmox/main/switchboard.php");
